package apiv1

import (
	"github.com/gin-gonic/gin"
	"go-shop-admin/internal/service"
	"net/http"
)

// Login 登录
func Login(c *gin.Context) {
	var loginService *service.LoginService
	if err := c.ShouldBind(&loginService); err != nil {
		//返回验证器验证错误信息
		c.JSON(http.StatusBadRequest, Validators(err))
		//写入日志
		return
	}

	res := loginService.Login(c.Request.Context())
	c.JSON(http.StatusOK, res)

}
